from django.db import models

# Create your models here.
class RulesModel(models.Model):
  """评估规则"""
  rule_name = models.CharField(max_length=200, default="", verbose_name="规则", help_text="规则")
  project_name = models.CharField(max_length=200, default="", verbose_name="项目", help_text="项目")
  check_content = models.CharField(max_length=200, default="", verbose_name="检查内容", help_text="检查内容")
  check_standard = models.TextField(max_length=300, default="", verbose_name="检查标准", help_text="检查标准")
  check_method = models.TextField(max_length=300, default="", verbose_name="检查方法", help_text="检查方法")
  notes = models.TextField(max_length=300, default="", verbose_name="备注", help_text="备注")
  is_check = models.BooleanField(default=False, verbose_name="是巡查" , help_text="是巡查")

  rule_score = models.FloatField(default=100, verbose_name="规则分", help_text="规则分")
  project_score = models.FloatField(verbose_name="项目分", help_text="项目分")
  content_score = models.FloatField(verbose_name="内容分", help_text="内容分")
  standard_score = models.FloatField(verbose_name="标准分", help_text="标准分")

  create_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间", help_text="创建时间")
  update_time = models.DateTimeField(auto_now=True, verbose_name="更新时间", help_text="更新时间")

  class Meta:
    verbose_name = ("RulesModel")
    verbose_name_plural = ("RulesModel")

  def __str__(self):
      return '${}_${}_${}'.format(self.project_name, self.check_content, self.check_standard)
